using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using dender.dvdcover.core;
using System.Drawing.Printing;

namespace dender.dvdcover.gui
{
    public partial class coverForm : Form
    {
        private List<Format> mFormatInventory;

        public coverForm()
        {
            InitializeComponent();
            mFormatInventory = new List<Format>();
        }

        private void coverForm_Load(object sender, EventArgs e)
        {
            FillInventory();

            formatListbox.DataSource = mFormatInventory;
            formatListbox.DisplayMember = "Description";
        }

        private void FillInventory()
        {
            Format f = new Format(280, 183);
            f.Description = "Standard DVD Cover A4";
            Part p = new Part(f, new PointF(0, 0), 280, 183);
            p.Name = "Main";
            f.Parts.Add(p);
            f.PaperKind = PaperKind.A4;
            f.AddDefaultCuttingLines();

            mFormatInventory.Add(f);
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            if (formatListbox.SelectedItem != null)
            {
                mainForm parent = (mainForm)this.Owner;
                Format f = (Format)formatListbox.SelectedItem;
                Cover c = new Cover(f);
                parent.Cover = c;
                this.Hide();
            }
        }
        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Hide();
        }
    }
}